﻿@model FeedbackService.Models.Site
@{
    ViewBag.Title = "Отзывы для " + Model.Url;
}
@*<p>
    @Html.ActionLink("Назад к списку сайтов", "Index")
</p>*@
<h2>@ViewBag.Title</h2>
<fieldset>
    <legend>@Model.Url</legend>
    <div class="display-field">
        @Html.DisplayFor(modelItem => Model.Description)
    </div>
    @if (Model.isCurrentUserOwner)
    {
        @Html.ActionLink("Встроить код в свой сайт", "Embed", new { id = Model.SiteId }); <text>
        | </text>
        @Html.ActionLink("Редактировать", "Edit", new { id = Model.SiteId }); <text> | </text>
        @Html.ActionLink("Удалить", "Delete", new { id = Model.SiteId });
    }
</fieldset>
<p>
    @Html.ActionLink("Добавить отзыв", "Create", "Feedback", new { id = Model.SiteId }, null)
</p>
<table>
    <tr>
        <th>
            Рейтинг
        </th>
        <th style="width: 100%">
            Текст
        </th>
    </tr>
    @foreach (var item in Model.Feedbacks)
    {
        <tr>
            <td>
                <strong>@Html.DisplayFor(modelItem => item.Rating) </strong>(@Html.ActionLink("+", "Vote", "Feedback", new { id = item.FeedbackId, isUp = true, returnUrl = Request.Url }, null))
            </td>
            <td>
                <div>
                    @Html.ActionLink(item.Title, "Details", "Feedback", new { id = item.FeedbackId }, null)
                </div>
                <div>
                    @Html.DisplayFor(modelItem => item.Message)
                </div>
                <div>
                    @Html.DisplayFor(modelItem => item.Proposed)
                    @if (Model.isCurrentUserOwner)
                    {
                        <text> | </text> @Html.ActionLink("Удалить", "Delete", "Feedback", new { id = item.FeedbackId }, null)
                    }
                </div>
            </td>
        </tr>
    }
</table>
